//
//  Presibmedicinem.m
//  EcmDoctor
//
//  Created by Mac on 16/3/4.
//  Copyright © 2016年 张进. All rights reserved.
//

#import "Presibmedicinem.h"
#import "NetWorkUtil.h"
#import <SSKeychain/SSKeychain.h>
#import "AppUtils.h"
@implementation Presibmedicinem
+(void)insertCureSchemeInfowithclientDrugInfo:(Presibmedicinem  *)presibmedicinem  success:(void (^)(NSNumber *))success failure:(void (^)(NSError *))failure
{
    NetWorkBaseRequest *req = [[NetWorkBaseRequest alloc] init];
    
    req.moduleName = @"DoctorRS";
    req.methodName = @"insertCureSchemeInfo";
   // presibmedicinem
    
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:[presibmedicinem  toDictionary] options:NSJSONWritingPrettyPrinted error:nil];
    NSString *str=[[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
   [req setValue:str forKey:@"cureSchemeList"];
    
    NSLog(@"-----------------%@",presibmedicinem);
    
    [NetWorkUtil requestWithPOST:req success:^(NetWorkBaseResponse *responseObject) {
        NSError *error = nil;
        
         NSLog(@"--------------%@",responseObject);
        NSLog(@"--------------%@",responseObject.msg);
        if (responseObject.code.integerValue == 1) {
            if (!responseObject.data) {
                success(nil);
                return;
            }
           
            
            if (error) {
                failure(error);
                return;
            }
            NSNumber *num=responseObject.code;
            success(num);
            
        }
        else{
            error = [NSError errorWithDomain:responseObject.msg code:responseObject.code.integerValue userInfo:nil];
            failure(error);
        }
        
    } failure:^(NSError *error) {
        failure(error);
        
    } cache:NO];

}
@end
